package com.utils



import java.util.{Calendar, Date}

import org.apache.commons.lang3.time.FastDateFormat

object DateUtils {
  /**
    * 获取yyyyMMdd格式当前日期
    * @return
    */
  def getNow():String={
    val format: FastDateFormat = FastDateFormat.getInstance("yyyyMMdd")

    format.format(new Date())
  }
  def getYesterday():String={
    val date = new Date()
    val calendar: Calendar = Calendar.getInstance()
    calendar.setTime(date)
    calendar.add(Calendar.DAY_OF_YEAR,-1)
    val format: FastDateFormat = FastDateFormat.getInstance("yyyyMMdd")
    format.format(calendar)
  }


}
